package com.timk.goserver.client.ui.widgets;

import com.google.gwt.user.client.ui.FocusListener;
import com.google.gwt.user.client.ui.FocusWidget;
import com.google.gwt.user.client.ui.Widget;

/**
 * This listener prevents widgets from receiving focus
 * @author TKington
 *
 */
public class NoFocusListener implements FocusListener {
	private final FocusWidget widget;
	
	/**
	 * Creates a NoFocusListener
	 * @param widget the widget that shouldn't get the keyboard focus
	 */
	public NoFocusListener(FocusWidget widget) {
		this.widget = widget;
	}

	public void onFocus(Widget sender) {
		widget.setFocus(false);
	}

	public void onLostFocus(Widget sender) {
		//	Do nothing
	}
}
